package com.wondertek.poms.dao.repo;

import com.wondertek.poms.dao.po.PrdInfoRule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p><b>IPcProductRuleDao Description:</b> 商品包规则 Dao 执行商品包规则 的查询、修改、新增、删除操作</p>
 * <p>@author 窦再兴</p>
 * <p><b>DATE</b> 2020-10-16 15:56:15</p>
 */
@Repository
public interface IPcPrdInfoRuleDao extends JpaRepository<PrdInfoRule, Long>, JpaSpecificationExecutor<PrdInfoRule> {

	@Query(value = "select * from PRD_RULE where PRD_INFO_ID=?1 and IS_PRD_SEL=?2 order by PRD_RULE_ID desc", nativeQuery = true)
	List<PrdInfoRule> findAllByPrdInfoIdAndIsprdSel(Long prdInfoId, Integer isprdSel);

	int deleteByPrdRuleId(Long prdRuleId);

	PrdInfoRule findByPrdRuleId(Long prdRuleId);

}
